package com.gitee.wsl.io.dataproxy

open class IntArrayProxy(val list: IntArray) : DataProxy<Int> {

    override fun iterator() = list.iterator()

    override val size: Int get() = list.size

    override fun get(index: Int): Int = list[index]

    override fun set(index: Int, value: Int) {
        list[index] = value
    }

    override fun fill(value: Int, fromIndex: Int, toIndex: Int) {
        list.fill(value, fromIndex, toIndex)
    }

    override fun values(): List<Int> = list.toList()
}

fun IntArray.asProxy() = IntArrayProxy(this)